package kz.simplex.photobox.action;

import kz.simplex.photobox.model.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("albumList")
public class AlbumList extends EntityQuery<Album> {

	private static final String EJBQL = "select album from Album album";

	private static final String[] RESTRICTIONS = {
			"lower(album.description) like lower(concat(#{albumList.album.description},'%'))",
			"lower(album.title) like lower(concat(#{albumList.album.title},'%'))",};

	private Album album = new Album();

	public AlbumList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Album getAlbum() {
		return album;
	}
}
